//
//  GWRightViewController.m
//  网易新闻
//
//  Created by qianfeng on 16/2/29.
//  Copyright (c) 2016年 高炜. All rights reserved.
//

#import "GWRightViewController.h"
#import "GWRightCenterRowView.h"
@interface GWRightViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *iconView;

@property (weak, nonatomic) IBOutlet UIView *centerView;

@property (weak, nonatomic) IBOutlet UIView *bottomView;
@end

@implementation GWRightViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setUpCenterViewWithImage:@"promoboard_icon_mall" title:@"商城 能赚能花，土豪当家"];
    [self setUpCenterViewWithImage:@"promoboard_icon_activities" title:@"活动 4.0发布会粉丝招募"];
    [self setUpCenterViewWithImage:@"promoboard_icon_apps" title:@"应用 金币从来都是这样送的"];
    // Do any additional setup after loading the view from its nib.
}

-(void)setUpCenterViewWithImage:(NSString *)image title:(NSString *)title
{
    GWRightCenterRowView *row =[GWRightCenterRowView rightCenterRowView];
    [row image:image];
    [row title:title];
    row.y =row.height*self.centerView.subviews.count;
    [self.centerView addSubview:row];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)showAll
{
    [UIView transitionWithView:self.iconView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
        self.iconView.image =[UIImage imageNamed:@"user_defaultgift"];
    } completion:^(BOOL finished) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            [UIView transitionWithView:self.iconView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
                self.iconView.image =[UIImage imageNamed:@"default_avatar"];
            } completion:nil];
        });
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
